from django.conf.urls import url, include
from rest_framework.routers import SimpleRouter
from rest_framework_jwt.views import obtain_jwt_token

from meiduo_admin.views.home_views import HomeView, GoodsVisitCountView
from meiduo_admin.views.login_views import *
from meiduo_admin.views.sku_views import SKUViewSet, SKUCategoryView, SPUSimpleView
from meiduo_admin.views.user_views import UserAPIView

urlpatterns = [
    # url(r'^authorizations/$', LoginView.as_view()),
    url(r'^authorizations/$', obtain_jwt_token),
    url(r'^statistical/goods_day_views/$', GoodsVisitCountView.as_view()),

    url(r'^users/$', UserAPIView.as_view()),

    url(r'^skus/$', SKUViewSet.as_view({"get":"list"})),

    url(r'^skus/categories/$', SKUCategoryView.as_view()),
    url(r'^goods/simple/$', SPUSimpleView.as_view()),
]

# 自定义路由器，用于多种不同请求方法路由映射；
router = SimpleRouter()
router.register(prefix='statistical',viewset=HomeView,base_name="home")
urlpatterns += router.urls